package com.android.memoprendiz.controller;

import com.android.memoprendiz.R;
import com.android.memoprendiz.model.Configuration;
import com.android.memoprendiz.model.ConfigurationsDAO;
import com.android.memoprendiz.model.Ranking;
import com.android.memoprendiz.model.RankingDAO;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class CadastroPontosActivity extends Activity {
	int pontos;
	
    @Override
    public void onCreate(Bundle estado) {
        super.onCreate(estado);
        
        ConfigurationsDAO CD = new ConfigurationsDAO(this);
        Configuration config = CD.getConfiguration();
        int id = this.getResources().getIdentifier(config.getCaminhoEstilo(), "style",this.getPackageName());
        this.setTheme(id);
        
        
        
        Intent in = getIntent();
        pontos = in.getIntExtra("pontuacao",0);
        setContentView(R.layout.activity_cadastro_pontos);
    }

    public void eventoBtnSalvar(View v){
    	EditText et = (EditText) findViewById(R.id.campoNome);
    	
    	String nome = et.getText().toString();
    	
    	
    	RankingDAO PD = new RankingDAO(this);
    	PD.salveRanking(new Ranking(nome, pontos));
    	
	 	Toast toast = Toast.makeText(this, "Pontos cadastrados", Toast.LENGTH_SHORT);
    	toast.show();
    	
    	finish();
    	
    }
}
